import { Controller, Post, Body, } from '@nestjs/common';
import { AuthService } from './auth.service';
import { CreateAuthDto } from './dto/create-auth.dto';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { ExcludeAuth } from './decorators/exclude-auth.decorator';

@ApiTags('auth')
@Controller('auth')
@ApiBearerAuth() //swagger文档添加token验证
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  // 注册
  @Post("/signup")
  @ExcludeAuth() // 排除权限验证
  signup(@Body() signupData: CreateAuthDto) {
    return this.authService.signup(signupData)
  }

  // 登录
  @Post("/login")
  @ExcludeAuth()// 排除权限验证
  login(@Body() loginData: CreateAuthDto) {
    return this.authService.login(loginData)
  }

}
